const Koa = require('koa');
const Router = require('koa-router');
const koaStatic = require('koa-static')
const views = require('koa-views');
const path = require('path');

const indexRouter = require('./router/index')

var router = new Router();
const app = new Koa();

let viewsPath = path.join(__dirname, './views')
app.use(views(viewsPath, {
  extension: 'ejs'
}))

const staticPath = path.join(__dirname, './public');

app.use(koaStatic(staticPath))

router.use('/api/', indexRouter.routes())

app.use(router.routes());

app.listen(3000, () => {
  console.log('localhost 3000 ...')
})